import { http } from "@/utils/http";
import { baseUrl } from "../base-url";

export const useIdentityApi = () => {
  return {
    /** 登录 */
    login: (data?: object) => {
      return http.request(
        "post",
        baseUrl("/admin/identity/login"),
        { data },
        {
          headers: {
            "Content-Type": "application/x-www-form-urlencoded"
          }
        }
      );
    },
    /** 刷新`token` */
    refreshTokenApi: (data?: object) => {
      return http.request("post", baseUrl("/admin/identity/refresh-token"), {
        data
      });
    }
  };
};
